//
//  SecondViewController.m
//  UI-09-作业
//
//  Created by dllo on 16/6/16.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SecondViewController.h"

@interface SecondViewController ()

@end

@implementation SecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
     self.navigationItem.title = @"第二页";
    self.view.backgroundColor = [UIColor yellowColor];
    // Do any additional setup after loading the view.
    [self creatSubviews];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)creatSubviews{
    UIScrollView *scroll = [[UIScrollView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    scroll.userInteractionEnabled = YES;
    scroll.pagingEnabled = YES;
    scroll.contentSize = CGSizeMake(self.view.frame.size.width * 6, 0);
    for (int i = 1; i < 7; i++) {
        NSString *name = [NSString stringWithFormat:@"p%d.jpg", i];
        UIImage *image = [UIImage imageNamed:name];
        UIImageView *imageView = [[UIImageView alloc]initWithImage:image];
        imageView.frame = CGRectMake(self.view.frame.size.width * (i - 1), 0, self.view.frame.size.width, self.view.frame.size.height);
        [scroll addSubview:imageView];
        
    }
    [self.view addSubview:scroll];
    
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
